#include<iostream>
#include<fstream>
using namespace std;
const short LEN = 30;
void multiply(short lh[], short rh, short result[]);
void factorial(short n, short result[]);
int main(int argc, char * argv[])
{
    short n;
    cout << "please input n: " << endl;
    cin >> n;
    short result[LEN];
    short begin = 0;
    for(short i = 0; i < LEN; i++)
    {
        if(result[i] != 0)
        {
            begin = i;
            break;
        }
    }
    for(short i = begin; i < LEN; i++)
    {
        cout << result[i];
    }
    cout<<endl;
    return 0;
}

void factorial(short n, short result[])
{
    short * lh;
    lh = new short[LEN];
    lh[LEN-1] = 1;
    for(short i = 1; i <= n; i++)
    {
        char * temp_result = new short[LEN];
        multiply(lh, i, temp_result);
        delete[] lh;
        lh = temp_result;
    }
    for(short i = 0; i <= LEN; i++)
    {
        result[i] = lh[i];
    }
}

void multiply(short lh[], short n, short result[])
{
